import {request} from '../../utils/request.js';
import {mockQuest} from '../../utils/mockQuest.js';
Page({
  data:{
    swiperList:[],
    cateList:[],
    floorList:[],
    ShopList: [{
      index: 1,
      image: '../../image/4.jpg',
      title: '好看的黑鞋子',
      price: '100',
      sales: '2.2万'
  },{
      index: 2,
      image: '../../image/5.jpg',
      title: '好看的白鞋子',
      price: '1000',
      sales: '85'
  },{
      index: 3,
      image: '../../image/2.jpg',
      title: '白色高跟鞋',
      price: '39.9',
      sales: '2000'
  },{
      index: 4,
      image: '../../image/10.jpg',
      title: '好看戒指',
      price: '100',
      sales: '2.2万'
  },{
      index: 5,
      image: '../../image/8.jpg',
      title: '另一个好看戒指',
      price: '39.9',
      sales: '2000'
  },{
      index: 6,
      image: '../../image/9.jpg',
      title: '有钻石的戒指',
      price: '100',
      sales: '2.2万'
  }]
  },
  onLoad:function(options) {
    this.getSwiperList();
    this.getCateGridList();
  },
  getSwiperList() {
    mockQuest({url:'WeChat_Index_swiperImgList'})
      .then(result => {
        let resCode = result['code'], resData = result['data'];
        console.log('轮播图', result);
        if (resCode === 200 && Object.prototype.toString.call(resData) === '[object Array]' && resData.length > 0) {
          this.setData({swiperList:resData});
        }
      });
  },
  getCateGridList() {
    mockQuest({url:'WeChat_Index_cateGridList'})
      .then(result => {
        let resCode = result['code'], resData = result['data'];
        console.log('分类导航', result);
        if (resCode === 200 && Object.prototype.toString.call(resData) === '[object Array]' && resData.length > 0) {
          this.setData({cateList:resData});
        }
      });
  }
});